﻿'use strict';
(function () {
    var app = angular.module('myApp', ['ui.router', 'ui.bootstrap', 'ngSanitize', 'myApp.Controllers', 'myApp.Services', 'myApp.Filters', 'myApp.Directives']);
})();

$(document).scroll(function () {
    var nScrollTop = $(this).scrollTop();
    var containerWidth = $('.container').width();
    var userconfigleftWidth = $('.user-config-left').width();
    var contentstyleWidth = containerWidth - userconfigleftWidth + 18;
    if (nScrollTop > 20) {
        $('.resultshow').css({
            position: 'fixed',
            width: contentstyleWidth
        });
    } else {
        $('.resultshow').css({
            position: 'absolute',
            width: '100%'
        });
    }
});

// 锚点跳转
$('.chioce-btn').delegate('a', 'click', function () {
    var name = $(this).attr('name');
    document.getElementById(name).scrollIntoView();
});

/* TODO: 暂时注释
// 左侧答题点击
$('.left-content').delegate('.question-cont', 'click', function () {
    var name = 'control_' + $(this).attr('id');
    document.getElementById(name).scrollIntoView();
});

// 左侧第一题答题点击情况
$('.left-content').delegate('.question-cont:first', 'click', function () {
    $(document).scrollTop(0);
});
*/

// 折叠题组
$('.chioce-btn').delegate('.question-resul-title', 'click', function () {
    if (!$(this).hasClass('closetitle')) {
        $(this).addClass('closetitle');
        $(this).parent().find('.question-resul-tab').hide();
        $(this).find('img').attr('src', rootUrl + 'App/images/ExamPaper/close.png');
    } else {
        $(this).removeClass('closetitle');
        $(this).parent().find('.question-resul-tab').show();
        $(this).find('img').attr('src', rootUrl + 'App/images/ExamPaper/open.png');
    }
});

// 表示业务操作结果的枚举
var ResultType = {
    Success: 0,
    NoChanged: 1,
    ParamError: 2,
    QueryNull: 3,
    PurviewLack: 4,
    IllegalOperation: 5,
    Warning: 6,
    Error: 7
};